package com.example.demo.leetcode.classics150;

/**
 * ******************************************************
 *
 * @author liugh9
 * @version 1.0
 * @classname _3删除有序数组中的重复项
 * @description
 * @date 2023/07/05 17:19
 * <p>
 * ******************************************************
 */
public class _3删除有序数组中的重复项 {

    public int removeDuplicates(int[] nums) {
        int slow = 0;
        int fast = 0;

        while (fast < nums.length) {
            if (nums[slow] != nums[fast]) {
                nums[++slow] = nums[fast];
            }
            fast++;
        }
        return slow + 1;
    }

}
